<template>
	<view class="function-card" @click="handleCardClick" hover-class="card-hover">
		<view class="card-content">
			<image class="icon" :src="icon"></image>
			<text class="card-title">{{ title }}</text>
			<text class="card-desc">{{ desc }}</text>
		</view>
		<!-- <view class="card-decoration"></view> -->
		<view class="card-corner top-left"></view>
		<view class="card-corner top-right"></view>
		<view class="card-corner bottom-left"></view>
		<view class="card-corner bottom-right"></view>
	</view>
</template>

<script setup>
	const props = defineProps({
		title: {
			type: String,
			default: '墓位查询',
		},
		desc: {
			type: String,
			default: '快速定位 便捷寻访',
		},
		icon: {
			type: String,
			default: '/static/images/mwcx.png',
		},
	});

	const emit = defineEmits(['cardClick']);

	const handleCardClick = () => {
		emit('cardClick');
	};
</script>
<style lang="scss" scoped>
	.function-card {
		flex: 1;
		background-color: rgba(248, 248, 248, 0.9);
		border-radius: 8px;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
		padding: 25px 15px;
		position: relative;
		overflow: hidden;
		transition: all 0.3s ease;
		border: 1px solid rgba(230, 230, 230, 0.8);
		z-index: 1;
		cursor: pointer;

		.card-content {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			height: 100%;
			position: relative;
			z-index: 2;
			gap: 15px;
		}

		.icon {
			width: 50px;
			height: 50px;
			margin-bottom: 5px;
			transition: all 0.3s ease;
			opacity: 0.9;
		}

		.card-title {
			font-size: 18px;
			font-weight: 500;
			color: #333;
			margin-bottom: 5px;
			letter-spacing: 2px;
			position: relative;
		}

		.card-desc {
			font-size: 12px;
			color: #888;
			letter-spacing: 1px;
			text-align: center;
		}

		.card-corner {
			position: absolute;
			width: 12px;
			height: 12px;
			border-color: rgba(200, 200, 200, 0.8);
			border-style: solid;
			border-width: 0;
			z-index: 1;

			&.top-left {
				top: 6px;
				left: 6px;
				border-top-width: 1px;
				border-left-width: 1px;
				border-radius: 1px 0 0 0;
			}

			&.top-right {
				top: 6px;
				right: 6px;
				border-top-width: 1px;
				border-right-width: 1px;
				border-radius: 0 1px 0 0;
			}

			&.bottom-left {
				bottom: 6px;
				left: 6px;
				border-bottom-width: 1px;
				border-left-width: 1px;
				border-radius: 0 0 0 1px;
			}

			&.bottom-right {
				bottom: 6px;
				right: 6px;
				border-bottom-width: 1px;
				border-right-width: 1px;
				border-radius: 0 0 1px 0;
			}
		}

		&:hover {
			transform: translateY(-2px);
			box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
			border-color: rgba(215, 215, 215, 1);
			background-color: rgba(250, 250, 250, 0.95);

			.icon {
				transform: scale(1.05);
				opacity: 1;
			}

			.card-title {
				color: #2878c5;
			}

			.card-desc {
				color: #666;
			}
		}

		&.card-hover {
			transform: scale(0.98);
			box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

			.icon {
				transform: scale(0.97);
			}
		}
	}
</style>
